package com.zwh.rocketmq.demo;

import com.zwh.rocketmq.demo.batch.BatchMessageProduct;
import com.zwh.rocketmq.demo.delay.DelayMessageProduct;
import com.zwh.rocketmq.demo.normal.NormalMessageProduct;
import com.zwh.rocketmq.demo.order.OrderMessageProduct;
import org.apache.rocketmq.client.producer.SendResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zwh
 * @date 2024-1-18 22:36
 */
@RestController
@RequestMapping("/rocketmq")
public class MessageDemoController {
    @Autowired
    private NormalMessageProduct normalMessageProduct;
    @Autowired
    private DelayMessageProduct delayMessageProduct;
    @Autowired
    private OrderMessageProduct orderMessageProduct;
    @Autowired
    private BatchMessageProduct batchMessageProduct;

    @GetMapping("/sendNormalMsg")
    public String sendNormalMsg() {
        normalMessageProduct.sendMsg();
        return "success";
    }

    @GetMapping("/sendOrderMsg")
    public String sendOrderMsg() {
        orderMessageProduct.sendOrderMsg();
        return "success";
    }

    @GetMapping("/sendDelayMsg")
    public String sendDelayMsg() {
        delayMessageProduct.sendDelayMsg();
        return "success";
    }

    @GetMapping("/sendBatchMsg")
    public String sendBatchMsg() {
        batchMessageProduct.sendBatchMsg();
        return "success";
    }
}
